home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / embedded / mcu11 / gloadd3b.arc / GPROGD3.ASM < prev    next >
Assembly Source File  |  1991-09-09  |  6KB  |  170 lines

  1. ******************************************************************************
  2. ******************************************************************************
  3. *                                                                            *
  4. *                    Routine to Program the D3 EPROM                         *
  5. *                                                                            *
  6. ******************************************************************************
  7. *                                                                            *
  8. * Program Name: GPROGD3.ASM                                                  *
  9. * Revision: 0.03                                                             *
  10. * Date: 9/09/91                                                              *
  11. * Written By: Robert Chretien                                                *
  12. *             Motorola MCU Applications                                      *
  13. * Assembled Under: Motorola Portable Cross Assembler (PASM) or               *
  14. *                  Motorola Freeware Assembler (AS11)                        *
  15. * Program Description:                                                       *
  16. *                                                                            *
  17. *                                                                            *
  18. *                                                                            *
  19. *                                                                            *
  20. *                                                                            *
  21. ******************************************************************************
  22. *                                                                            *
  23. * Revision Descriptions:                                                     *
  24. * 1. Rev 0.00: Original program.                                             *
  25. * 2. Rev 0.01: Added header and comments.                                    *
  26. *              Since not used Wait4Trans was removed.                        *
  27. *              LED is turned on at start of program.                         *
  28. * 3. Rev 0.02: Use different means of determining end of s19 file so that    *
  29. *              now there is no limit to the size of the file.                *
  30. *              Modified software handshaking to increase speed of transfer   *
  31. *              between HC11 and IBM.                                         *
  32. *              Changed programming delay down to 2ms per spec.               *
  33. * 4. Rev 0.03: Gets boot ROM start address from boot reset vector rather     *
  34. *              than assuming it will always stay the same.                   *
  35. *                                                                            *
  36. ******************************************************************************
  37. ******************************************************************************
  38.  
  39. RAM          EQU        $0040
  40. REGS         EQU        $0000
  41. Eprom        EQU        $F000
  42. Vectors         EQU    $FFD6
  43. PortA        EQU        REGS+$00
  44. PortC        EQU        REGS+$03
  45. PortB        EQU        REGS+$04
  46. DDRC         EQU        REGS+$07
  47. PortD        EQU        REGS+$08
  48. DDRD         EQU        REGS+$09
  49. CFORC        EQU        REGS+$0B
  50. TCNT         EQU        REGS+$0E
  51. TOC2         EQU        REGS+$18
  52. TCTL1        EQU        REGS+$20
  53. TCTL2        EQU        REGS+$21
  54. TMSK1        EQU        REGS+$22
  55. TFLG1        EQU        REGS+$23
  56. TMSK2        EQU        REGS+$24
  57. TFLG2        EQU        REGS+$25
  58. PACTL        EQU        REGS+$26
  59. Baud         EQU        REGS+$2B
  60. SCCR2        EQU        REGS+$2D
  61. SCSR         EQU        REGS+$2E
  62. SCDR         EQU        REGS+$2F
  63. OPTION       EQU        REGS+$39
  64. *
  65. *
  66. *
  67. TalkAddress  EQU     RAM
  68. Address      EQU     RAM+1
  69. RecordLength EQU     RAM+3
  70. CheckSum     EQU     RAM+4
  71. BoardAddress EQU     RAM+5
  72. *
  73. *
  74. *
  75.              ORG     RAM
  76. Initial      LDS     #$00FF               !Set stack pointer to $FF.
  77.              LDAA    #$30
  78.              STAA    Baud                 !With 8MHz crystal, baud=9600.
  79.              LDAA    #$0C
  80.              STAA    SCCR2                !Transmitter and receiver enabled.
  81.              LDAA    #%00100000
  82.              STAA    DDRD
  83.              STAA    PortD
  84. *
  85. *
  86. *
  87.              CLR     TalkAddress
  88. CalCheckSum  LDAA    #$05
  89.              STAA    CheckSum
  90. CalAddress   LDAA    PortD
  91.              LSRA
  92.              LSRA
  93.              ANDA    #%00000111
  94.              STAA    BoardAddress
  95. BootRecAddr  BSR     RecOneAddr
  96.              CBA
  97.              BNE     Boot4Last
  98.              STAA    SCDR
  99.              BSR     RecOneAddr
  100.              LDAA    CheckSum
  101.              STAA    SCDR
  102. Boot4Last    CMPB    #08
  103.              BNE     BootRecAddr
  104. *
  105. *
  106. *
  107. RecTalk      BSR     RecOneAddr
  108.              CBA
  109.              BNE     RecNewRec
  110.              STAB    SCDR
  111.              INC     TalkAddress
  112. RecNewRec    LDX     #Address
  113.              LDY     #3
  114. RecTranInfo  BSR     RecOneAddr
  115.              STAB    0,X
  116.              LDAA    TalkAddress
  117.              BEQ     IncX1
  118.              STAB    SCDR
  119. IncX1        INX
  120.              DEY
  121.              BNE     RecTranInfo
  122.              LDX     Address
  123.              BEQ     ThatsAll
  124.              LDAB    RecordLength
  125.              SUBB    #3                   !Record length contains byte
  126.              CLRA                         ! count for address and checksum.
  127.              XGDY
  128. RecData      BSR     RecOneAddr
  129. ProgData     LDAA    #$20
  130.              STAA    $003B
  131.              STAB    0,X
  132.              LDAA    #$21
  133.              STAA    $003B
  134.              JSR     DLY02
  135.              CLR     $003B
  136.              LDAA    TalkAddress
  137.              BEQ     IncX2
  138.              STAB    SCDR
  139. IncX2        INX
  140.              DEY
  141.              BNE     RecData
  142.              BRA     RecNewRec
  143. ThatsAll     BSR     RecOneAddr
  144.              LDX     $BFFE
  145.              JMP     0,X                  !Jump back to Boot ROM.
  146. *
  147. *
  148. *
  149. DLY02        PSHX
  150.              LDX     #670                 !2ms = 670
  151. DLY02Loop    DEX
  152.              BNE     DLY02Loop
  153.              PULX
  154.              RTS
  155. *
  156. *
  157. *
  158. RecOneAddr   LDAA    BoardAddress
  159.              LDAB    SCSR
  160.              ANDB    #%00100000
  161.              BEQ     RecOneAddr
  162.              LDAB    SCDR
  163.              RTS
  164. *
  165. *
  166. *
  167. END          EQU     *
  168.              END
  169.  
  170.